<?php

namespace App\Models;


/**
 * App\Models\Mechanism
 *
 * @property int $id
 * @property int|null $user_id 用户id
 * @property string|null $cert_img 证书图片
 * @property string|null $cover 封面/经营图片
 * @property string|null $name 机构名称
 * @property string|null $desc 机构介绍
 * @property int|null $price_min 价格-低
 * @property int|null $price_max 价格-高
 * @property int|null $score 评分
 * @property string|null $s_num 税号
 * @property string|null $address 详细地址
 * @property string|null $mobile 联系电话
 * @property int|null $province_id 省id
 * @property int|null $city_id 市id
 * @property int|null $area_id 区id
 * @property string|null $province_name 省名称
 * @property string|null $city_name 市名称
 * @property string|null $area_name 区名称
 * @property int|null $is_rec 推荐（1：推荐，0：不推荐）
 * @property int|null $status 审核（0：待审核，1：审核成功，2：审核失败）
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism query()
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism whereAddress($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism whereAreaId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism whereAreaName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism whereCertImg($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism whereCityId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism whereCityName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism whereCover($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism whereDesc($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism whereIsRec($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism whereMobile($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism wherePriceMax($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism wherePriceMin($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism whereProvinceId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism whereProvinceName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism whereSNum($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism whereScore($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Mechanism whereUserId($value)
 * @mixin \Eloquent
 */
class Mechanism extends Base
{
    protected $table = 'mechanism';

    static $fields = [
        'id', 'cover', 'name',
        'desc', 'price_min', 'price_max',
        'score'
    ];

    // 首页推荐的5个机构
    static function getIndexRec()
    {
        return self::whereIsRec(1)
            ->where('status', 1)
            ->limit(5)
            ->get(self::$fields);
    }
}
